<%--
 *  File:    DevelopDoctorManage.jsp
 *  @Author: jackwang	
 *  Date:    2013/7/4
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.DevelopDoctorManage");
  String strModuleName = "COM";
  String strTableName = "v_doctormanage";
  String privilegeCode = "A01003";
  String contextPath = request.getContextPath();

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@include file="/inc/Print.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>
<html>
<head>
<title>DevelopDoctorManage</title>
<PageFlow:CheckPageFlow pageName="p_doctormanage"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/cn/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
	Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
	if(searchresults == null) searchresults = new Vector();
	
	String  isfirst = (String) pageContext.getAttribute("isfirst");
	
	  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
	  if(UserInfo == null) UserInfo = new HashMap();
	
	//System.out.println(searchresults.size()+"[");
%>
<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "DevelopDoctorManage.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
function monthresult(){
	document.cform.actionname.value = "save";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
function page_add(){
	document.cform.actionname.value = "add";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
window.onload=function(){
          // cform.startdate.value=new Date().toFormatString("yyyy-mm-dd");
          // cform.enddate.value=new Date().toFormatString("yyyy-mm-dd");
}
function popAreaNew(num){
	if(popwindow!=null) popwindow.close();
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
    if(isEmpty(document.cform.areaid1.value)){
      alert("请选择省区！");
      document.cform.stdareaname.focus();
      return;
    }
	var currentnum = document.cform.currentnum.value;
    url = 'AreaPopWindow.jsp?areaid1='+document.cform.areaid1.value+'&<%= OvalTools.randomURL() %>';
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function SetAreaPop(areaid,areacode,areaname){
	var currentnum = document.cform.currentnum.value;
	document.cform['areaid2'+currentnum].value = areaid;
	//document.cform['businessareacode'+currentnum].value = areacode;
	document.cform['areaname'+currentnum].value = areaname;
}
function popBusinessarea(num){
    //url = "UserAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
    url = "<%=contextPath%>/masterdata/upm/UserStdAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    attribute = "height=400, width=650,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	popwindow = window.open(url,"newwindow", attribute);
}

function set_orgNameByAreaWindow(id,areaname){
    var currentnum = document.cform.currentnum.value;
    document.cform['areaid1'+currentnum].value = id;
    document.cform['stdareaname'+currentnum].value = areaname;
}
function popWindowsContactProd(num){
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
 	if(isEmpty(document.cform['criteriontype'+currentnum].value)){
      alert("请选择类型！");
      document.cform['criteriontype'+currentnum].focus();
      return;
    }
    var criteriontype=document.cform['criteriontype'+currentnum].value;
    if(criteriontype==1)  document.cform['datacategory'+currentnum].value=7;
    if(criteriontype==2)  document.cform['datacategory'+currentnum].value=8;
    if(criteriontype==3)  document.cform['datacategory'+currentnum].value=14;
    if(popwindow!=null) popwindow.close();
 	popwindow = window.open("<%=contextPath%>/masterdata/ogm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&zyldatacategory="+document.cform['datacategory'+currentnum].value, "newwindow", "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes")

}
 function set_orgNameByPopWindow(id,code,name){
    var currentnum = document.cform.currentnum.value;
    idObj=document.getElementById("productgroupid"+currentnum);
    nameObj=document.getElementById("productgroupname"+currentnum);
    //captionname=document.getElementById("captionname"+idx);
	nameObj.value=name;
	//captionname.value=name;
	idObj.value=id;
    //document.getElementById("captionname"+idx).command="notnull";
}
 function showdiv(num){
    if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
 	if(document.cform['criteriontype'+currentnum].value==3 && document.cform['opentype'+currentnum].value==2){
 	 document.cform['analyzecriteria'+currentnum].disabled='';
 	 document.cform['analyzecriteria'+currentnum].command="notnull";
 	}else{
 	 document.cform['analyzecriteria'+currentnum].disabled=true;
 	}
}


function page_upload(){
		var year=document.cform.year.value;
		var quarterofyear=document.cform.quarterofyear.value;
		this.location.href = "<%= contextPath%>/zylprocessgoals/ZylUploadDocstdProcessGoals.jsp?&<%= OvalTools.randomURL() %>&year="+year+"&quarterofyear="+quarterofyear;
}


function page_downexport(hq) {
	/*
	var disregionid = document.cform.disregionid.value;//提报省份ID
	var tenderconfigid = document.cform.tenderconfigid.value;//招标类型ID
	var dictionaryid=document.cform.dictionaryid.value;//药品目录属性
	var prodid = document.cform.prodid.value;//竞标产品
    var sysdates=document.cform.sysdates.value;//系统时间
    var startdate=document.cform.startdate.value;//开始时间
    var enddate=document.cform.enddate.value;//结束时间
	*/
    

	//var url = "<%=reportURL%>/servlet/ExcecuteReport/temp_docstdprocessgoals.sox?__format=xlsx&__folder=/ovalreport&disregionid="+disregionid+"&tenderconfigid="+tenderconfigid+"&dictionaryid="+dictionaryid+"&prodid="+prodid+"&sysdates="+sysdates+"&startdate="+startdate+"&enddate="+enddate;
	var deptid = cform.deptids.value;
	var year =cform.year.value;
	var quarter =cform.quarterofyear.value;
	getolddate();
	var url = "<%=reportURL%>/servlet/ExcecuteReport/temp_docstdprocessgoals.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value+"&year="+year+"&quarter="+quarter+"&deptid="+deptid+"&oldyear="+document.cform.oldyear.value+"&oldmonth="+document.cform.oldmonth.value;
	if(isEmpty(hq)){
	   url=url+"&hq=1";
	}
	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
	popwindow = window.open(url, "n1window", strstatus);
	                
}


function page_upload11(){
	this.location.href = "<%= contextPath%>/zylprocessgoals/UpDocstdprocessgoals.jsp?&<%= OvalTools.randomURL() %>";
}
function getolddate(){
  var d = new Date();
  var year=d.getFullYear();
  var month=d.getMonth()+1;
  var oldyear;
  var oldmonth;
  if(month==1 || month==2 || month==3){
    oldyear=year-1;
    oldmonth=12;
  }
  if(month==4 || month==5 || month==6){
    oldyear=year;
    oldmonth=3;
  }
  if(month==7 || month==8 || month==9){
    oldyear=year;
    oldmonth=6;
  }
  if(month==10 || month==11 || month==12){
    oldyear=year;
    oldmonth=9;
  }
  document.cform.oldyear.value=oldyear;
  document.cform.oldmonth.value=oldmonth;
}
</script>

</head>
 <%
  Calendar nowtime = Calendar.getInstance();
  int currentYear = nowtime.get(Calendar.YEAR);
  int currentMonth = nowtime.get(Calendar.MONTH) + 1;
  int currentQuarter=-1;
  if(currentMonth == 1 || currentMonth ==2 || currentMonth ==3){
	  currentQuarter=1;
  }
  else if(currentMonth == 4 || currentMonth ==5 || currentMonth ==6){
	  currentQuarter=2;
  }
  else if(currentMonth == 7 || currentMonth ==8 || currentMonth ==9){
	  currentQuarter=3;
  }
  else if(currentMonth == 10 || currentMonth ==11 || currentMonth ==12){
	  currentQuarter=4;
  }
 %>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
<input type="hidden" name="pagename" value="p_doctormanage">
<input type="hidden" name="isfirst" value="N">
<input type="hidden" name="actionname">
<input type="hidden" name="currentnum">
<input type="hidden" name="datacategory">
<input type="hidden" name="oldyear">
<input type="hidden" name="oldmonth">
 <input type="hidden" name="numrows" value="<%=searchresults.size() %>"/>
 <custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden>
<table width="100%" cellspacing="0">
  <% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
</table>
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td>
      <table width="800" border="0" cellspacing="0" onkeydown="if(event.keyCode==13) page_summary('search');" >
      <tr>
      
              <td>
               <div align="left">
                  <font color=black><%= label.getLabelName("L_Year1") + label.getLabelName("L_Colon") %></font>
               </div>
              </td>
			  <td>
                  <custom:selectdic property="year" dictType="Years"/>
              </td>
                         <% if(!("N".equals(isfirst))){ %>
                          <script type="text/javascript">
		                    var d = new Date();
                            var year=d.getFullYear();
                             document.cform.year.value=year;
		                  </script>
		                  <%}%>
              <td>
              <div align="left">
                 <font color=black><%= label.getLabelName("L_Quarter") + label.getLabelName("L_Colon") %></font>
              </div>
             </td>
             <td>
               <%if(pageContext.getAttribute("quarterofyear") == null ){%>
                 <custom:selectdic dictType="Quarter" property="quarterofyear" value="<%=String.valueOf(currentQuarter) %>" />
               <%}else{ %>
                 <custom:selectdic dictType="Quarter" property="quarterofyear" />
               <%} %>
            </td>
			<td><%=label.getLabelName("L_Type")+ label.getLabelName("L_Colon")%></td>
			<td>
				<custom:selectdic dictType="DicrelationType" property="dicrelationtype" valueCriteria="3" />
         	</td>
			<td><%=label.getLabelName("L_Dept") +label.getLabelName("L_Colon")%></td>
			<td>
					<custom:select property="deptids" optionsName="alldeptnames" optionValueKey="deptid" optionInnerTextKey="deptname" />
				    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				    <a href="javascript:page_summary('search')"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a>
         	</td>			
	  </table>
    </td>
  </tr>
  <tr>
    <td>
    <div style="overflow:auto;clear: both;float:left;height:350" id="scrollGDiv">
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="2000">
          <tr class="deepblue-left">
          <td width="1%"  class="title_center">&nbsp;</td>
          <td width="4%" class="title_center"><a href="javascript:page_summary('orderby','arean1ame')"><%=label.getLabelName("L_Provicetdr")%></a></td>
          <td width="4%" class="title_center"><a href="javascript:page_summary('orderby','deptname')"><%=label.getLabelName("L_Dept")%></a></td>
          <td width="4%" class="title_center"><a href="javascript:page_summary('orderby','area2name')"><%=label.getLabelName("L_RegionOffice")%></a></td>
          <td width="5%" class="title_center"><a href="javascript:page_summary('orderby','isbalename')"><%=label.getLabelName("L_YesOrNoBale")%></a></td>
          <td width="5%" class="title_center"><a href="javascript:page_summary('orderby','yllevel')"><%=label.getLabelName("L_Grade")%></a></td>
          <td width="5%" class="title_center"><a href="javascript:page_summary('orderby','productgroupname')"><%=label.getLabelName("L_Variety")%></a></td>
          <td width="6%" class="title_center"><a href="javascript:page_summary('orderby','quarteramount')"><%=label.getLabelName("L_SalesIndex")%><%=label.getLabelName("L_/")%><%=label.getLabelName("L_MoneyMyriad")%></a></td>
          <td width="5%" class="title_center"><a href="javascript:page_summary('orderby','lockorg')"><%=label.getLabelName("L_Blocked")%><%=label.getLabelName("L_Terminal")%><%=label.getLabelName("L_Qty")%></a></td>
          <td width="5%" class="title_center"><a href="javascript:page_summary('orderby','lockamount')"><%=label.getLabelName("L_Blocked")%><%=label.getLabelName("L_DoctorNum")%></a></td>
          <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','recamount')"><%=label.getLabelName("L_DoctorPrescription")%><%=label.getLabelName("L_/")%><%=label.getLabelName("L_A")%></a></td>
          <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','goalamount')"><%=label.getLabelName("L_AimDoctorPrescription")%><%=label.getLabelName("L_/")%><%=label.getLabelName("L_A")%></a></td>
          <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','divineamount')"><%=label.getLabelName("L_AmountPrescription")%><%=label.getLabelName("L_Thousand")%></a></td>
          <td width="12%" class="title_center"><a href="javascript:page_summary('orderby','modifygoal')"><%=label.getLabelName("L_Modify")%><%=label.getLabelName("L_AimDoctorPrescription")%><%=label.getLabelName("L_/")%><%=label.getLabelName("L_A")%></a></td>
          <td width="14%" class="title_center"><a href="javascript:page_summary('orderby','modifydivineamount')"><%=label.getLabelName("L_Modify")%><%=label.getLabelName("L_AmountPrescription")%><%=label.getLabelName("L_Thousand")%></a></td>
          </tr>
          <%
             int j = 0;
             int s=1;
             String strClassType = new String();
             String strIsChecked = "";
             Integer defaultId = new Integer(-1);
             boolean bHasChecked = false;
            
          %>
          <logic:iterate id="doctors" collection="<%= searchresults %>" indexId="seq">
          	<%
            HashMap doctorinfo = (HashMap)pageContext.getAttribute("doctors");
            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }

           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              //defaultId = (Integer)pageConfig.get("opencriterionid");
              bHasChecked = true;
              
            }else{
           		strIsChecked = "";
            }
            // s= ((Integer)pageConfig.get("opencriterionid")).intValue();
            j++;
          %>
          	<tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>"
          		onclick="javascript:radiotrue('radio<%=JspHelper.filterNull(j)%>');clickRow('<custom:write name="doctors" property="docstdprocessgoalsid" nbsp="true"/>')"
          		>
	            <td width="2%">
	              <input class="normalradio" id="radio<%=JspHelper.filterNull(j)%>" type="radio" name="doctorinfo" changedName="fileids" <%=JspHelper.filterNull( strIsChecked)%>>
	            </td>
	            <td>
	               <custom:write  name="doctors" property="arean1ame" />&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="deptname"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="area2name"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="isbalename"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="yllevel" dictType="HProcessType"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="productgroupname"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="quarteramount" />&nbsp;
	            </td>
	             <td>
	               <custom:write  name="doctors" property="lockorg" />&nbsp;
	            </td>
	             <td>
	               <custom:write  name="doctors" property="lockamount" />&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="recamount"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="goalamount"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="divineamount"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="modifygoal"/>&nbsp;
	            </td>
	            <td>
	               <custom:write  name="doctors" property="modifydivineamount"/>&nbsp;
	            </td>	 	            	            	            	            	            	            	            	            
	         </tr>
          </logic:iterate>
    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
    </table>
    </div>
   </td>
 </tr>
    <table width="100%">
        <tr> 
          <td class="summary_top"></td>
        </tr>
		<tr >
			  <td class="td_center"><!-- HQ-SubmitDoc -->
               <a onclick="page_upload();"><custom:button type="1" label="L_Upload" imgsrc="CreatSubDept.gif" style="width:60" /></a>
               <a onclick="page_downexport();"><custom:button type="1" label="L_TemplateDownReport" imgsrc="CreatSubDept.gif" style="width:90" /></a>
               <custom:button value="总部修改下载" styleClass="button1" style="width:80px;" onclick="page_downexport('hq')"  privilegeCode="HQ-ModifyDoc"/>
	          </td>
		</tr>
	</table>
</table></table></table>
</form>
 </table>
<script>
  document.getElementById("scrollGDiv").style.width=(screen.availWidth - 30);
</script>
</body>
</html>


